//
//  ByCellLookDoctorHeader.m
//  jinpuyiyuan_ios
//
//  Created by pro on 2017/12/12.
//  Copyright © 2017年 mc. All rights reserved.
//

#import "ByCellLookDoctorHeader.h"

@implementation ByCellLookDoctorHeader
{
    UIImageView     *_icon;
    UILabel         *_nickNameLabel;
    UILabel         *_addressLabel;
}
+ (instancetype)cellWithTableView:(UITableView*)tableView{
    
    static NSString *cellIdentifier = @"ByCellLookDoctorHeader";
    ByCellLookDoctorHeader *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (cell == nil) {
        cell = [[self alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
    }
    return cell;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSeparatorStyleNone;
        [self createViews];
    }
    return self;
}

- (void)createViews{
    _addressLabel = [[UILabel alloc] init];
    [self addSubview:_addressLabel];
    [_addressLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(10));
        make.right.equalTo(@(-10));
        make.bottom.equalTo(@(-20));
        make.height.equalTo(@(20));
    }];
    _addressLabel.textAlignment = NSTextAlignmentCenter;
    _addressLabel.font = FONT(14);
    _addressLabel.textColor = [UIColor lightGrayColor];
    
    _nickNameLabel =[[UILabel alloc] init];
    [self addSubview:_nickNameLabel];
    [_nickNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(10));
        make.bottom.equalTo(_addressLabel.mas_top).offset(-5);
        make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH - 20, 20));
    }];
    _nickNameLabel.font= FONT(16);
    _nickNameLabel.textAlignment = NSTextAlignmentCenter;
    
    _icon = [[UIImageView alloc] init];
    [self addSubview:_icon];
    [_icon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(@(20));
        make.left.equalTo(@((SCREEN_WIDTH - 50) / 2));
        make.size.mas_equalTo(CGSizeMake(50, 50));
    }];
    _icon.backgroundColor = BY_THEME_COLOR;
    _icon.layer.cornerRadius = 50 / 2;
    
}

- (void)setModel:(ByModelRegistrationDoctor *)model{
    _model = model;
    _nickNameLabel.text = _model.nick_name;
    _addressLabel.text = _model.address;
}


@end
